<?php

class WarePaymentForm {

    public function __construct($amount) {
        $this->title = "Pay $amount";
        $this->form_id = "pid";
        $this->itemscode = "";
        $label = new Label("Go to Mpesa ad pay " . $amount . " to 0725002471 and enter the transaction code below");
        $this->addItem($label);
        $textfield = new TextField("transCode", "Enter Code");
        $this->addItem($textfield);
    }

    public function addItem($WFItem) {
        if (strlen($this->itemscode) > 0) {
            $this->itemscode = $this->itemscode . Sympols::$split2 . $WFItem->getCode();
        } else {
            $this->itemscode = $WFItem->getCode();
        }
    }

    public function getCode() {
        return "form" . Sympols::$split1 . $this->title . Sympols::$split1 . "pid" . Sympols::$split1 . $this->itemscode;
    }

}

?>
